package org.wu.framework.saas.share.platform.prop;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;
import java.util.List;

@Configuration
@ConfigurationProperties(prefix = SaasShareProp.prefix)
@Data
public class SaasShareProp {
    public static final String prefix = "spring.lazy.saas-share";
    /**
     * 根据请求头中的指定字段获取切换数据源使用的value
     */
    private String requestHeaderShareKey = "tenant_id";

    /**
     * 数据库数据隔离字段
     */
    private String shareColumnName = "tenant_id";

    /**
     * 忽略的路径
     */
    private List<String> unCheckApiPath = Arrays.asList(
            "/token/**",
            "/error/**",
            "/swagger-ui.html/**",
            "/favicon.ico",
            "/swagger-resources/**",
            "/webjars/**",
            "/v3/api-docs/**",
            "/sys/user/findUseZoneList",
            "/sys/user/createAndInitZone",
            "/token/access_token",
            "/druid/**",
            "/v1/api/**",
            "/v1/online/**"
    );

    public void setUnCheckApiPath(List<String> unCheckApiPath) {
        unCheckApiPath.addAll(this.unCheckApiPath);
        this.unCheckApiPath = unCheckApiPath;
    }

}
